package com.lc.recovery.ui.fragment;

import android.os.Bundle;
import android.view.View;

import com.flyco.tablayout.SlidingTabLayout;
import com.lc.recovery.R;
import com.lc.recovery.adapter.MyFragmentPagerAdapter;
import com.lc.recovery.app.AppFragment;
import com.lc.recovery.ui.activity.HomeActivity;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;

public class MessageBusinessFragment extends AppFragment<HomeActivity> {

    @BindView(R.id.slidingTabLayout)
    SlidingTabLayout slidingTabLayout;
    @BindView(R.id.viewpager)
    ViewPager viewpager;


    private MyFragmentPagerAdapter mAdapter;

    private List<String> titles = new ArrayList<>();//title集合

    private List<Fragment> fragments = new ArrayList<>();//碎片集合

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_messagebusiness;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }


    @Override
    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        viewpager.setOffscreenPageLimit(2);
        titles.add("公告通知");
        titles.add("回收新闻");
        titles.add("到账信息");

        fragments.add(MessageListFragment.newInstance("1"));
        fragments.add(MessageListFragment.newInstance("2"));
        fragments.add(MessageListFragment.newInstance("3"));

        mAdapter = new MyFragmentPagerAdapter(getChildFragmentManager(), fragments, getContext(), titles);
        viewpager.setAdapter(mAdapter);
        slidingTabLayout.setViewPager(viewpager);
//        dataBeanList.add("为什么回收废金属可减少对");
//        dataBeanList.add("为什么回收废金属");
//        recoveryadapter = new BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_business_message, dataBeanList) {
//            @Override
//            protected void convert(@NotNull BaseViewHolder baseViewHolder, String s) {
//                baseViewHolder.setText(R.id.tv_title, s);
//            }
//        };
//        rvRecoveryMessage.setAdapter(recoveryadapter);
    }


}